import http from "@/utils/http/hub";

/**
 * 获取用户信息
 */
export const getUserInfo = (
  params,
  config = {
    custom: {
      auth: true,
      loading: false,
    },
  }
) => {
  return http.get({
    url: `/user/detail`,
    params,
    config,
  });
};

/**
 * 编辑用户信息
 */
export const editUserInfo = (
  params,
  config = {
    custom: {
      auth: true,
      loading: true,
    },
  }
) => {
  return http.post({
    url: `/user/updateDetail`,
    params,
    config,
  });
};

/**
 * 获取实名认证信息
 */
export const getRealInfo = (params, config = {}) => {
  return http.post({
    url: `/user/getRealInfo`,
    params,
    config,
  });
};

/**
 * 实名认证时获取token
 */
export const getRealToken = (params, config = {}) => {
  return http.post({
    url: `/user/getRealToken`,
    params,
    config,
  });
};

/**
 * 实名认证回调
 */
export const realCallback = (params, config = {}) => {
  return http.post({
    url: `/user/realCallback`,
    params,
    config,
  });
};

/**
 * 设置安全码
 * phone 手机号
 * sms_code 手机验证码
 * safetyPassword 安全密码
 */
export const setSafetyPassword = (params, config = {}) => {
  return http.post({
    url: `/user/setSafetyPassword`,
    params,
    config,
  });
};
